import request from '@/utils/request'

// 查询课程安排列表
export function listCourseSchedule(query) {
  return request({
    url: '/course/schedule/list',
    method: 'get',
    params: query
  })
}

// 根据班级ID查询课程安排列表
export function getCourseSchedulesByClaId(claId) {
  return request({
    url: `/course/schedule/list/${claId}`,
    method: 'get'
  })
}

// 查询课程安排详细
export function getCourseSchedule(scheduleId) {
  return request({
    url: `/course/schedule/${scheduleId}`,
    method: 'get'
  })
}

// 新增课程安排
export function addCourseSchedule(data) {
  return request({
    url: '/course/schedule',
    method: 'post',
    data: data
  })
}

// 一键添加模板课程
export function batchAddCourseSchedule(data) {
  return request({
    url: '/course/schedule/batch',
    method: 'post',
    data: data
  })
}

// 一键加课（基于已有课程模式）
export function oneClickAddSchedule(data) {
  return request({
    url: '/course/schedule/oneClick',
    method: 'post',
    data: data
  })
}

// 修改课程安排
export function updateCourseSchedule(data) {
  return request({
    url: '/course/schedule',
    method: 'put',
    data: data
  })
}

// 拖拽更新课程日期
export function dragUpdateCourseDate(data) {
  return request({
    url: '/course/schedule/drag',
    method: 'put',
    data: data
  })
}

// 删除课程安排（软删除）
export function delCourseSchedule(scheduleIds) {
  return request({
    url: `/course/schedule/${scheduleIds}`,
    method: 'delete'
  })
}

// 恢复课程安排
export function restoreCourseSchedule(scheduleId) {
  return request({
    url: `/course/schedule/restore/${scheduleId}`,
    method: 'put'
  })
}

// 标记课程为已完成
export function completeCourseSchedule(scheduleId) {
  return request({
    url: `/course/schedule/complete/${scheduleId}`,
    method: 'put'
  })
}
